﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="HumanResorcesProj.GUI.Login.Register1" MasterPageFile="~/GUI/MasterOfPopUps.Master" %>


<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">

      <div dir="rtl">
          <table style="width: 100%;">
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td>
                      &nbsp;
                  </td>
                  <td>
                      &nbsp;
                  </td>
              </tr>
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td>
                      &nbsp;
                      <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                          AutoGenerateColumns="False" BackColor="LightGoldenrodYellow" BorderColor="Tan" 
                          BorderWidth="1px" CellPadding="2" DataKeyNames="UserName" 
                          DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="None" Width="216px">
                          <Columns>
                              <asp:CommandField ShowDeleteButton="True" />
                              <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                                  SortExpression="UserName" />
                          </Columns>
                          <FooterStyle BackColor="Tan" />
                          <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
                              HorizontalAlign="Center" />
                          <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                          <HeaderStyle BackColor="Tan" Font-Bold="True" />
                          <AlternatingRowStyle BackColor="PaleGoldenrod" />
                      </asp:GridView>
                      <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                          CellPadding="4" DataKeyNames="UserName" DataSourceID="ObjectDataSource1" 
                          DefaultMode="Insert" ForeColor="#333333" GridLines="None" Height="50px" 
                          oniteminserted="DetailsView1_ItemInserted" Width="289px">
                          <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                          <CommandRowStyle BackColor="#FFFFC0" Font-Bold="True" />
                          <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                          <FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />
                          <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                          <Fields>
                              <asp:BoundField DataField="UserName" HeaderText="שם משתמש" ReadOnly="True" 
                                  SortExpression="UserName" />
                              <asp:BoundField DataField="Password" HeaderText="סיסמא" 
                                  SortExpression="Password" />
                              <asp:TemplateField ShowHeader="False">
                                  <InsertItemTemplate>
                                      <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                          CommandName="Insert" Text="הכנס"></asp:LinkButton>
                                      &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                          CommandName="Cancel" Text="בטל"></asp:LinkButton>
                                  </InsertItemTemplate>
                                  <ItemTemplate>
                                      <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                          CommandName="New" Text="New"></asp:LinkButton>
                                  </ItemTemplate>
                              </asp:TemplateField>
                          </Fields>
                          <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                          <AlternatingRowStyle BackColor="White" />
                      </asp:DetailsView>
                      <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                          InsertMethod="InsertNewUserRegister" SelectMethod="GetData" 
                          TypeName="HumanResorcesProj.BLL.Login">
                          <InsertParameters>
                              <asp:Parameter Name="UserName" Type="String" />
                              <asp:Parameter Name="PassWord" Type="String" />
                          </InsertParameters>
                      </asp:ObjectDataSource>
                      <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                          ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                          DeleteCommand="DELETE FROM [Login] WHERE [UserName] = @UserName" 
                          InsertCommand="INSERT INTO [Login] ([UserName], [Password]) VALUES (@UserName, @Password)" 
                          SelectCommand="SELECT [UserName], [Password] FROM [Login]" 
                          UpdateCommand="UPDATE [Login] SET [Password] = @Password WHERE [UserName] = @UserName">
                          <DeleteParameters>
                              <asp:Parameter Name="UserName" Type="String" />
                          </DeleteParameters>
                          <UpdateParameters>
                              <asp:Parameter Name="Password" Type="String" />
                              <asp:Parameter Name="UserName" Type="String" />
                          </UpdateParameters>
                          <InsertParameters>
                              <asp:Parameter Name="UserName" Type="String" />
                              <asp:Parameter Name="Password" Type="String" />
                          </InsertParameters>
                      </asp:SqlDataSource>
                      <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                          ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                          DeleteCommand="DELETE FROM [Login] WHERE [UserName] = @UserName" 
                          InsertCommand="INSERT INTO [Login] ([UserName]) VALUES (@UserName)" 
                          
                          SelectCommand="SELECT UserName FROM Login WHERE (UserName &lt;&gt; 'admin')">
                          <DeleteParameters>
                              <asp:Parameter Name="UserName" Type="String" />
                          </DeleteParameters>
                          <InsertParameters>
                              <asp:Parameter Name="UserName" Type="String" />
                          </InsertParameters>
                      </asp:SqlDataSource>
                  </td>
                  <td>
                      &nbsp;
                  </td>
              </tr>
              <tr>
                  <td>
                      &nbsp;
                  </td>
                  <td>
                      &nbsp;
                  </td>
                  <td>
                      &nbsp;
                  </td>
              </tr>
          </table>
      </div>  
                             

</asp:Content>


